#include "StdAfx.h"
#include "McDropSource.h"

CMcDropSource::CMcDropSource()
{
}

CMcDropSource::~CMcDropSource(void)
{
}

DROPEFFECT CMcDropSource::DoDragDrop(const MC_DROP_DATA* pData)
{
	HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(MC_DROP_DATA));
	DROPEFFECT dropEffect = DROPEFFECT_NONE;
	
	if(hGlobal)
	{
		MC_DROP_DATA* pDropData = static_cast<MC_DROP_DATA*>(GlobalLock(hGlobal));

		if(pDropData)
		{
			*pDropData = *pData;
			GlobalUnlock(hGlobal);

			m_DataSource.CacheGlobalData(CF_MC_DROP_DATA, hGlobal);
			dropEffect = m_DataSource.DoDragDrop();

		}

		GlobalFree(hGlobal);
	}

	return dropEffect;
}
